#pragma once
#include <vector>

using namespace std;

namespace missingNumber
{
	class Solution {
	public:
		//int missingNumber(vector<int>& nums) {
		//	int length = nums.size();
		//	int sum = (0 + length) * (length + 1) / 2;
		//	for (int i = 0; i < length; i++)
		//		sum -= nums[i];
		//	return sum;
		//}

		int missingNumber(vector<int>& nums) {
			int r = 0;
			int length = nums.size();
			for (int i = 0; i < length; i++)
				r ^= nums[i];
			return r;
		}
	};
}